package com.share.pattern;

import java.util.Scanner;

/**
 * 
 * @author Johnny Tam
 *
 *         面向对象方式编写
 *         使用多态实例化对象
 *         暂时只有 + ， -
 */
public class CalculatorDemoV04 {

	public static void main(String[] args) {
		/**
		 * v0.4 面向对象编程
		 *  
		 * 客户端代码
		 */
		
		Operation oper;
		oper = OperationFactory.creatOperate("+");
		
		oper.setmNumberA(10);
		oper.setmNumberB(20);
		
		double result = oper.getResult();
		System.out.println(result);

		oper = OperationFactory.creatOperate("-");
		oper.setmNumberA(10);
		oper.setmNumberB(20);
				
		System.out.println("A - B = " + oper.getResult());
	}

}
